package Servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import beanUtils.BeanUtility;
import beans.PersonalDetailsBean;

public class AddPersonalDetails extends HttpServlet{
	public String firstname=null;
	PersonalDetailsBean pdb=new PersonalDetailsBean();
	

	public void doGet(HttpServletRequest req, HttpServletResponse res)
			throws IOException, ServletException {
		try{
			doPost(req, res);
		}
		catch(Exception e){
			
		}
	}///do get///////
	public void doPost(HttpServletRequest req, HttpServletResponse res)
			throws IOException, ServletException {
		HttpSession ses=req.getSession();
		System.out.println("hello , this is pd servlet");
		BeanUtility.populateBean(pdb, req);
		System.out.println(pdb.toString());
		
		/*firstname=pdb.getFname();
		
		String lname=pdb.getLname();
		
		String homeaddress=pdb.getC_address();
		
		String dob=pdb.getDob();
		
		String homecity=pdb.getC_city();
		
		String email=pdb.getEmail();
		
		int faxno=Integer.parseInt(pdb.getFaxno());
		
		int homepincode=Integer.parseInt(pdb.getC_pincode());
		
		int mobileno=Integer.parseInt(pdb.getMobileno());
		
		String panno= pdb.getPanno();
		
		String occupation=pdb.getOccupation();
		
		String status=pdb.getStatus();
		
		String outaddress=pdb.getO_address();
		
		int outpin=Integer.parseInt(pdb.getO_pincode());
		
		String outcity=pdb.getO_city();
		
		int officeno=Integer.parseInt(pdb.getOfficeno());
		
		int homeno=Integer.parseInt(pdb.getHomeno());
		
		String otherstatus=pdb.getOtherstatus();
		
		String otherocc=pdb.getOtheroccupation();
		
		ses.setAttribute("fname", firstname);
		ses.setAttribute("lname", lname);
		ses.setAttribute("otherocc", otherocc);
		ses.setAttribute("otherstatus", otherstatus);
		ses.setAttribute("homeno", homeno);
		ses.setAttribute("officeno", officeno);
		ses.setAttribute("outcity", outcity);
		ses.setAttribute("outaddress", outaddress);
		ses.setAttribute("status", status);
		ses.setAttribute("outpin", outpin);
		ses.setAttribute("occupation", occupation);
		ses.setAttribute("panno", panno);
		ses.setAttribute("mobileno", mobileno);
		ses.setAttribute("homepincode", homepincode);
		ses.setAttribute("faxno", faxno);
		ses.setAttribute("email", email);
		ses.setAttribute("homecity", homecity);
		ses.setAttribute("dob", dob);
		ses.setAttribute("homeaddress", homeaddress);
		ses.setAttribute("kyc_status", 0);*/



		System.out.println("code executed!!!");
		RequestDispatcher requestDispatcher = req
				.getRequestDispatcher("./registration.jsp");
		requestDispatcher.forward(req, res);
		
		
	}
}
